import { BaseEntity } from '@cool-midway/core';
import { Column, Index, Entity } from 'typeorm';

/**
 * doupiaopiao模块-订单表
 */
@Entity('doupiaopiao_order')
export class DoupiaopiaoOrderEntity extends BaseEntity {
  @Column({ comment: '用户ID', length: 50 })
  userId: string;

  @Index({ unique: true })
  @Column({ comment: '订单号', length: 50, nullable: true })
  orderNo: string;

  @Column({ comment: '抖音支付订单号', length: 50, nullable: true })
  dyPayOrderNo: string;

  @Column({ comment: '支付状态 -1退款 0待支付 1已支付', default: 0 })
  payStatus: number;

  @Column({
    comment:
      '订单进度 -2出票失败 -1支付超时 0待支付订单 1派出订单 2锁定订单 3出票成功 4完成订单',
    default: 0,
  })
  orderProgress: number;

  @Column({ comment: '支付方式 0无 1抖音支付', default: 0 })
  payType: number;

  @Column({ comment: '下单商户号', length: 50, nullable: true })
  merchantNo: string;

  @Column({ comment: '确认下单时间', nullable: true })
  confirmOrderTime: Date;

  @Column({ comment: '退款时间', nullable: true })
  refundTime: Date;

  @Column({ comment: '是否支持快速出票', default: false })
  isQuick: boolean;

  @Column({
    comment: '普通支付金额',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0,
  })
  normalPayAmount: number;

  @Column({
    comment: '快速支付金额',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0,
  })
  quickPayAmount: number;

  @Column({
    comment: '订单总佣金',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0,
  })
  totalCommission: number;

  @Column({ comment: '出票时间', nullable: true })
  ticketTime: Date;

  @Column({
    comment: '原价',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0,
  })
  originalPrice: number;

  @Column({ comment: '退款原因', nullable: true })
  refundReason: string;

  @Column({ comment: '电影票数量', default: 0 })
  ticketNum: number;

  @Column({ comment: '是否允许换座 0不支持 1支持', default: 0 })
  allowChangeSeat: number;

  @Column({ comment: '用户手机号', length: 11 })
  userPhone: string;

  @Column({ comment: '附加参数', nullable: true })
  extraParams: string;

  @Column({ comment: '数据源 1芒果', default: 1 })
  dataSource: number;

  @Column({ comment: '来源平台 1抖音', default: 1 })
  sourcePlatform: number;

  //   电影信息

  @Column({ comment: '电影ID', length: 50 })
  movieId: string;

  @Index()
  @Column({ comment: '院线ID', nullable: true, length: 50 })
  cinemaLineId: string;

  @Index()
  @Column({ comment: '城市ID', nullable: true, length: 50 })
  cityId: string;

  @Index()
  @Column({ comment: '影院ID', length: 50 })
  cinemaId: string;

  @Index()
  @Column({ comment: '影院code', nullable: true, length: 50 })
  cinemaCode: string;

  @Index()
  @Column({ comment: '电影code', nullable: true, length: 50 })
  filmCode: string;

  @Index()
  @Column({ comment: '场次ID', length: 50, nullable: true })
  scheduleId: string;

  @Column({ comment: '电影开场时间', nullable: true })
  startTime: Date;

  @Column({ comment: '电影时长', nullable: true })
  duration: number;

  @Column({ comment: '电影名称', nullable: true, length: 50 })
  movieName: string;

  @Column({ comment: '影院所在的城市名称', nullable: true, length: 50 })
  cityName: string;

  @Column({ comment: '影院名称', nullable: true, length: 50 })
  cinemaName: string;

  @Column({ comment: '影院地址', nullable: true, length: 200 })
  cinemaAddres: string;

  @Column({ comment: '影厅名称', nullable: true, length: 50 })
  hallName: string;

  @Column({ comment: '场次介绍', nullable: true })
  scheduleDesc: string;

  @Column({ comment: '电影海报', nullable: true })
  moviePoster: string;

  //   座位数据
  @Column({ comment: '座位数据', nullable: true, type: 'json' })
  seatData: string;
}
